﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MyVoteMVC.Domain.VT_Questions>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    项目详细
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <%foreach (VT_Questions pQuestion in Model)
          {
              Html.RenderPartial("ProjectItemGridControl", pQuestion);
          } %>
    </div>
    <div id="result">
        <ul class="splitter">
            <li>
                <% if ((bool)ViewData["ticketSubmit"])
                   {%>
                <button class="t-button" onclick="submitTicket()">
                    提交</button>
                <button class="t-button" onclick="saveTicket()">
                    保存</button><%}
                   else
                   {%>&nbsp; <a class="t-button" target="_blank" href="<%= Url.Action("VoteResult","Home",new {id = ViewContext.RouteData.Values["ID"].ToString()}) %>">
                       查看结果</a>
                <%} %></li>
        </ul>
    </div>
    <script type="text/javascript">
        function onRowSelect(e) {
            var row = e.row;
            var pid = $('input:checkbox', row).eq(0).attr("pid");
            $('#projectInfo').fadeOut();
            $.post("/home/ProjectById/" + pid, function (response) {
                $('#projectInfo').html(response);
                $('#projectInfo').fadeIn();
            });
        }
        function saveTicket() {
            var $checkedRecords = $(':checked');
            if ($checkedRecords.length < 1) {
                alert('您还没有选择');
                return;
            }
            $('#result').load('<%= Url.Action("SaveTicket", "Grid") %>', $checkedRecords);
            return true;
        }

        function submitTicket() {
            var $checkedRecords = $(':checked');
            if ($checkedRecords.length < 1) {
                alert('您还没有选择');
                return;
            }
            $('#result').load('<%= Url.Action("SubmitTicket", "Grid") %>', $checkedRecords);
        }
        if ('<%= TempData["ModelErrorMsg"] %>' != '') {
            alert('<%= TempData["ModelErrorMsg"] %>');
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
